﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using JCNT.DAL;
//using JCNT.NoteWeb.Pub;

namespace JCNT.NoteWeb.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        public string src_edit;
        public string src_qry;
        public string src_add;

        CSQLServer ado1 = new CSQLServer();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Session["login"] = "li0544";
                if (Session["login"] != null)
                {
                    if (Session["nodeID"] != null)
                    {
                        string s_id = Session["nodeID"].ToString();
                        src_edit = "Edit.aspx?id=" + s_id + "&typ=0";
                        src_add = "Edit.aspx";
                        src_qry = "Query.aspx";
                    }


                }
                else
                {
                    //跳转到登入页面                
                    Response.Write("<script>alert('您的登录信息过期，请重新登录！');</script>");
                    //Response.Write("<script>window.opener = null;parent.close();window.open ('login.aspx');</script>");
                    Response.Redirect("login.aspx");
                }

            }

        }

        protected void btn_edt_Click(object sender, EventArgs e)
        {
            if (Session["nodeID"] == null)
            {
                Response.Write("<script>alert('请选择要修改的数据！');</script>");
                return;
            }
            string s_id = Session["nodeID"].ToString();
            Session["Edit_Type"] = 0;
            Response.Redirect("Edit.aspx?id=" + s_id + "&typ=0");
        }

        protected void btn_add_Click(object sender, EventArgs e)
        {
            Session["Edit_Type"] = 1;
            Response.Redirect("Edit.aspx");
        }

        protected void btn_del_Click(object sender, EventArgs e)
        {
            string s_id = Session["nodeID"].ToString();
            JCNT.BLL.DB.wp_Note bll = new JCNT.BLL.DB.wp_Note();
            bll.Delete(Convert.ToInt32(s_id));
            Session["nodeID"] = null;
        }

        protected void btn_qry_Click(object sender, EventArgs e)
        {
            Response.Redirect("Query.aspx");
        }


    }
}
